package com.dufang.thread08Callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @ClassName:Test
 * @Description TODO
 * @Author Administrator
 * @Date 2025/7/7/007 20:34
 * @Version 1.0
 **/
public class Test {
    public static void main(String[] args) throws ExecutionException,InterruptedException {
        MyCallable myCallable=new MyCallable();
        FutureTask<String> futureTask=new FutureTask<>(myCallable);

        //创建Thread对象->Thread（Runnable target）
        Thread t1=new Thread(futureTask);
        t1.start();

        //调用get方法获取call方法返回值
        System.out.println(futureTask.get());
    }
}
